import request from '@/utils/request'

// 封装获取部门架构列表的请求
export function getDepartment() {
  return request({
    url: '/company/department',
    method: 'get'
  })
}

// 封装获取部门负责人列表的请求
// 若里面的method请求方法不写的话，默认是get请求
export function getManagerList() {
  return request({
    url: '/sys/user/simple'
  })
}

// 封装新增部门的请求
export function addDepartment(data) {
  return request({
    url: '/company/department',
    method: 'post',
    data
  })
}

// 封装获取对应部门详情的请求
export function getDepartmentDetail(id) {
  return request({
    url: `/company/department/${id}`
  })
}

// 封装修改部门详情的请求
export function updateDepartmentDetail(data) {
  return request({
    url: `/company/department/${data.id}`,
    method: 'put',
    data
  })
}

// 封装删除部门层级的请求
export function deleteDepartment(id) {
  return request({
    url: `/company/department/${id}`,
    method: 'delete'
  })
}